<!DOCTYPE html>
<head>
  <#assign dicSelect = JspTaglibs["http://www.casic304.cn/dicSelect"]/>
  <#assign secSelect = JspTaglibs["http://www.casic304.cn/secSelect"] />
  <#assign DutyDept = JspTaglibs["http://www.casic304.cn/DutyDept"]/>
  <meta charset="utf-8">
  <title>反馈周进展</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
  <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
  <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
  <script type="text/javascript">
    var __ctx = "${ctx}";
  </script>
  <style>
    .qbdms-TBinformation {
      font-size: 15px
    }
    #content{
      border:1px solid #D2D2D2;
    }
    .fillBtn{
      background:rgba(38,130,255,1) !important;s
    }
    .qbdms-textarea{
      padding:0;
    }
  </style>
  <#if isClose == 'true'>
  <style>
    .listBody .qbdms-bodyDiv{padding: 0 }
    body.qbdms-particulars .qbdms-bodyDiv div.layui-table-view-body{padding: 16px}
    .btnformItem{background: none}
  </style>
</#if>
</head>
<body class="listBody qbdms-particulars">
<div class="qbdms-bodyDiv">
  <div class="layui-table-view-body qbdms-add-view-body">
    <#if isClose != 'true'> <div class="qbdms-formTitle">质量问题信息 <i class="qbdms-returnOn closeWindow">返回</i></div></#if>
  <form class="formPreview layui-form" requrl="${ctx}/qbdms/wQbdFalProblemreset/get" lay-filter="wQbdFalProblemresetDataForm">
    <div class="" style="width: 100%;overflow-x: auto">
      <table class="tableExcel qbdms-zeroTable" width="100%" border="0" cellspacing="0" cellpadding="0">
        <tbody>
        <tr id="tbxx"></tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            质量问题名称<span style="color: red;">*</span>
          </td>
          <td name="fProblemname"></td>
          <td class="qbdms-zeroTable-lable">
            密级<span style="color: red;">*</span>
          </td>
          <td>
            <@secSelect.sec_select data_src=1 required=true name="secret"/>
          </td>
          <td class="qbdms-zeroTable-lable">
            问题发生时间<span style="color: red;">*</span>
          </td>
          <td name="fDetecttime"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            型号代号<span style="color: red;">*</span>
          </td>
          <td name="fModelsymbol"></td>
          <td class="qbdms-zeroTable-lable">
            型号名称<span style="color: red;">*</span>
          </td>
          <td name="fModelname"></td>
          <td class="qbdms-zeroTable-lable">
            型号类别<span style="color: red;">*</span>
          </td>
          <td name="fModeltype"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            工作阶段<span style="color: red;">*</span>
          </td>
          <td name="fWorkphase1"></td>
          <td class="qbdms-zeroTable-lable">
            故障产品名称<span style="color: red;">*</span>
          </td>
          <td name="fProductname"></td>
          <td class="qbdms-zeroTable-lable">
            型号研制阶段<span style="color: red;">*</span>
          </td>
          <td name="fModeldevelopphase"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            故障件阶段<span style="color: red;">*</span>
          </td>
          <td name="fBreakphase"></td>
          <td class="qbdms-zeroTable-lable">
            是否首飞
          </td>
          <td name="fIffirstfly"></td>
          <td class="qbdms-zeroTable-lable">
            是否靶场质量问题
          </td>
          <td name="fIfshooting"></td>


        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            问题级别<span style="color: red;">*</span>
          </td>
          <td name="fProblemlever"></td>
          <td class="qbdms-zeroTable-lable">
            问题发生地点
          </td>
          <td name="fDetectplace"></td>

          <td class="qbdms-zeroTable-lable">
            责任单位(研究室)
          </td>
          <td name="fDutydeptRoomName"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            生产分类<span style="color: red;">*</span>
          </td>
          <td name="fProduceclass"></td>
          <td class="qbdms-zeroTable-lable">
            所属分系统名称(院使用)
          </td>
          <td name="fSubsystemname"></td>
          <td class="qbdms-zeroTable-lable">
            所属分系统名称(所内使用)
          </td>
          <td name="fSubsystemnameFill"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            是否三类问题<span style="color: red;">*</span>
          </td>
          <td name="fIfthree"></td>
          <td class="qbdms-zeroTable-lable">
            （故障产品）硬件/软件<span style="color: red;">*</span>
          </td>
          <td name="fSofthard"></td>
          <td class="qbdms-zeroTable-lable">
            原因分类(一级)<span style="color: red;">*</span>
          </td>
          <td name="fCausationclass1"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            原因分类(二级)
          </td>
          <td name="fCausationclass2"></td>
          <td class="qbdms-zeroTable-lable">
            原因分类(三级)
          </td>
          <td name="fCausationclass3"></td>
          <td class="qbdms-zeroTable-lable">
            问题责任单位
          </td>
          <td name="fDutydept"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            责任单位性质<span style="color: red;">*</span>
          </td>
          <td name="fDutydeptnature"></td>
          <td class="qbdms-zeroTable-lable">
            问题等级
          </td>
          <td name="fProblemrank"></td>
          <td class="qbdms-zeroTable-lable">
            故障产品级别
          </td>
          <td name="fProblemLevel"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            是否批次性
          </td>
          <td name="fIfbatch"></td>
          <td class="qbdms-zeroTable-lable">
            型号批次<span style="color: red;">*</span>
          </td>
          <td name="fModelbatchno"></td>
          <td class="qbdms-zeroTable-lable">
            影响产品数量
          </td>
          <td name="fProblemQuantity"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            故障产品所属产品批次
          </td>
          <td name="fProductbatchno"></td>

          <td class="qbdms-zeroTable-lable">
            是否完成归零<span style="color: red;">*</span>
          </td>
          <td name="fIfreset"></td>
          <td class="qbdms-zeroTable-lable">
            归零方式
          </td>
          <td name="fResettype"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            归零周期(天)
          </td>
          <td name="fResetday"></td>
          <td class="qbdms-zeroTable-lable">
            解决情况
          </td>
          <td name="fSolveresult"></td>
          <td class="qbdms-zeroTable-lable">
            质量部门负责人
          </td>
          <td name="qualityLeader"></td>
        </tr>
        <tr class="waixieTr">
          <td class="qbdms-zeroTable-lable">
            外协外购乙方<span style="color: red;">*</span>
          </td>
          <td name="fOutdeptname"></td>
          <td class="qbdms-zeroTable-lable">
            是否集团内配套<span style="color: red;">*</span>
          </td>
          <td name="fIfmating"></td>
          <td class="qbdms-zeroTable-lable">
            行业<span style="color: red;">*</span>
          </td>
          <td name="fIndusty"></td>
        </tr>
        <tr class="waixieTr">
          <td class="qbdms-zeroTable-lable">
            外协性质<span style="color: red;">*</span>
          </td>
          <td name="fOutnature" colspan="5"></td>
        </tr>
        <tr class="ruanjianTr">
          <td class="qbdms-zeroTable-lable">
            软件等级<span style="color: red;">*</span>
          </td>
          <td name="fSoftrank" colspan="5"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            问题处理方式
          </td>
          <td name="fMeasureclass"></td>
        </tr>

        <tr>
          <td class="qbdms-zeroTable-lable">
            问题/故障现象描述<span style="color: red;">*</span>
          </td>
          <td name="fFailuredescription" colspan="5"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            问题原因描述
          </td>
          <td name="fCausation" colspan="5"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            纠正措施
          </td>
          <td name="fCorrectmeasure" colspan="5"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            举一反三
          </td>
          <td name="fRanage" colspan="5"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            “四个两”要求对照分析
          </td>
          <td name="fFourrefer" colspan="5"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            管理因素分析
          </td>
          <td name="fManagefactoranalysis" colspan="5"></td>
        </tr>

        <tr>
          <td class="qbdms-zeroTable-lable">
            技术归零时间
          </td>
          <td name="fSkillresettime"></td>
          <td class="qbdms-zeroTable-lable">
            管理归零时间
          </td>
          <td name="fManageresettime" colspan="3"></td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            技术归零
          </td>
          <td colspan="5">
            <div class="uploadFileList" fileUploadName="fSkillcerfile"></div>
          </td>
        </tr>
        <tr>
          <td class="qbdms-zeroTable-lable">
            管理归零
          </td>
          <td colspan="5">
            <div class="uploadFileList" fileUploadName="fManagecerfile"></div>
          </td>
        </tr>
        </tbody>
      </table>
    </div>

  <input type="text" hidden class="time-init" name="fDetecttime" format="yyyy-MM-dd"/>
  <input type="text" hidden class="time-init" name="fSkillresettime" format="yyyy-MM-dd"/>
  <input type="text" hidden class="time-init" name="fManageresettime" format="yyyy-MM-dd"/>
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
      <legend>归零进展</legend>
    </fieldset>
    <ul class="layui-timeline" id="contentList">
    </ul>
    <button type="button" class="layui-btn layui-btn-sm fillBtn" style="float: right;margin-bottom: 10px;" id="more">加载更多</button>
    <div class="qbdms-textarea">
      <textarea rows="2" class="layui-textarea" placeholder="请输入"  maxlength="650" id="content"></textarea>
    </div>
    <button type="button" id="save" class="layui-btn layui-btn-sm fillBtn" style="float: right;margin-top: 10px;">保存周进展</button>

    <#if isClose != 'true'>
    <div class="layui-form-item btnformItem">
      <p>
        <button type="reset" id="closeWindow"
                class="layui-btn layui-btn-sm btn-save qbdms-oneBtnLine">返回
        </button>
      </p>
    </div>
  </#if>
  </form>


</div>
</div>




<script src="${ctx}/public/component.js" type="text/javascript"></script>
<script src="${ctx}/json/comboselect.js" type="text/javascript"></script>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
  layui.config({
    base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'setter','common', 'jquery', 'propsHandle','publicMethods', 'qbdmsForm'], function () {

    // -----常量声明----------
    var $ = layui.jquery,
        setter = layui.setter,  // 配置信息
        common = layui.common,
        publicMethods = layui.publicMethods,
        formId = '${formDefId}' || '',
        propsHandle = layui.propsHandle,
        form = layui.qbdmsForm;
    $(".subContTem").hide();
    $(".qbdms-SubTableTitle").hide();
    $(".qbdms-tableDiv").hide();
    $(".ruanjianTr").hide();
    $(".waixieTr").hide();
    $(".zerenzhuijiuTr").hide();
    var  defProps = {
          viewMould: 'moulds/', // 组件模块 存放文件 *****
          selectorBtn: '.selectorBtn'
        },
        temQuery = new propsHandle();  // 实例化模板功能部分

    // 初始化模板功能
    temQuery.initTem({
      selectorBtn: defProps.selectorBtn,
      selectorTemPath: setter.views + defProps.viewMould
    });

    var count = 1;
    $(document).on('click', '.addFormTr1', function () {
      count += 1;
      var modetype = $(this).attr('modetype'),
          copyObj = $(this).parent().children('.subFormTable'),
          copyHtm = copyObj.find('tr').eq(1);
      if (modetype === '2') {
        //在这里做一个转换，控制子表隐藏行的必填
        var copyHtmlStr = copyHtm.html();
        copyHtmlStr = copyHtmlStr.replace(/requiredflag/g, "lay-verify");
        // 表格
        copyObj.append('<tr class="temSpace">' + copyHtmlStr + '</tr>');
        // copyObj.append('<tr class="temSpace">' + copyHtm.html() + '</tr>');
        var trArr = copyObj.find('tr');
        trArr.eq(trArr.length - 1).find('td').eq(0).find('.temTag').html(trArr.length - 2);
        // trArr.eq(trArr.length - 1).find('td').eq(6).find('button').attr("id","fSkillcerfileList"+count);
        trArr.eq(trArr.length - 1).find('.fileUpload').attr("id", "fSkillcerfileList" + count);

        trArr.eq(trArr.length - 1).find('[isinit="1"]').each(function (i, item) {
          $(item).attr('isinit', '2');
        });
        if (trArr.length > 3) {
          trArr.eq(trArr.length - 1).find('[type=radio]').each(function (i, item) {
            $(item).attr('name', (trArr.eq(1).find('[type=radio]').eq(i).attr('name')) + '_' + (trArr.length - 2))
          });
        }
      } else if (modetype === '1') {
        // updateTr(copyObj, copyHtm);
      }
      form.render();
      publicMethods.bottomFixd()
    });

    //关闭当前页面
    $("#closeWindow,.closeWindow").click(function () {
      var mdb = "${mark}";
      if('db' === mdb && undefined !== mdb){
        var close = parent.document.getElementsByClassName("layui-layer-close");
        close[1].click();
        return;
      }
      var backUrl='/qbdms/wQbdFalProblemreset/view/list';
      if("${backUrl}" != ""){
        backUrl="${backUrl}";
      }
      window.location.href = serverPath.qbdmsPath +backUrl ;
    });

    var runId = "${runId}";
    if (runId == null || runId == '') {
      $("#hideAndShow").show();
    }

    common.updateForm({
      name: 'wQbdFalProblemresetDataForm',
      idValue: "${id}",
      primary: "id",
      getCallback: function (data) {
        $("#tbxx").html("<td class='qbdms-zeroTable-lable'>填报信息:</td><td colspan='5'>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</td>");
        //-修改页面 初始化附件组件 开始 ------------------------------------------
        $('.uploadFileList').each(function () {
          var fileUploadName = $(this).attr("fileUploadName");
          var jsonFile = data.data[fileUploadName];
          var files = eval(jsonFile);

          if (files) {
            for (var i = 0; i < files.length; i++) {
              var fileLevel = files[i].fileLevel;
              var fileLevelText = files[i].fileLevelText;
              var fileSec = '<div class="fileSecLevel fileSecXg layui-input-inline">' + '<@secSelect.sec_select data_src=1 hasBlank=false/>' + "</div>";
              var newStr = '<span class="file-id" style="margin-right: 20px;" fileId=' + files[i].fileId + ' fileLevelText="' + fileLevelText + '">' + fileSec + '<span class="file-name" title="点击下载文件" onclick="downFile(this)">' + files[i].fileName + '</span></span>';
              $(this).append(newStr);
              $(this).find("select:last").val(fileLevel);
              $(this).find("select:last").attr("disabled", "disabled");
            }
          } else {
            $(this).html("<span style='color: #c0c4cc'>未上传</span>");
          }
        });
        //-修改页面 初始化附件组件 结束 ------------------------------------------
        $('table.subFormTable').each(function () {
          var table = {
            tableName: $(this).attr('class').split(" ")[1],
            fields: []
          };
          table.fields = data.data[table.tableName];
          if(table.fields.length==0){
            $(this).parent(".qbdms-tableDiv").append("<p>无数据</p>")
          }else {
            $(this).parent(".qbdms-tableDiv").css('padding',"0px")
          }
          for (var i = 0, len = table.fields.length; i < len; i++) {
            var dataRow = table.fields[i];
            var temp = $("." + table.tableName).prev().click();
            //这里有子表表头占一行，子表隐藏行占一行，所以取需要赋值的行时，需要temp=i+2
            var domRow = $(this).find("tr.temSpace:eq(" + (i * 1 + 2) + ")");
            $.each(dataRow, function (j, val) {
              var domItem = domRow.find("[name$='" + j + "']");
              if (domItem) {
                domItem.html(val);
              }
            });
          }
        });

        //-修改页面 外协外购 开始 ---------------------------------------------------
        var fCausationclass1 = data.data["fCausationclass1"];
        if (fCausationclass1 == "外协" || fCausationclass1 == "外购") {
          $(".waixieTr").show();
          common.setComponentRequired(["fOutdeptname", "fIfmating", "fIndusty", "fOutnature"], true);
        }
        //-修改页面 外协外购 结束 ---------------------------------------------------

        //-修改页面 软件 开始 ------------------------------------------------------------
        var fCausationclass1 = data.data["fCausationclass1"];
        var fCausationclass2 = data.data["fCausationclass2"];
        if (fCausationclass1 == "软件" || fCausationclass2 == "软件") {
          $(".ruanjianTr").show();
          common.setComponentRequired(["fSoftrank"], true);
        }
        //-修改页面 软件 结束 ------------------------------------------------------------
        var fIfduty = data.data["fIfduty"];
        initIfDutyDiv(fIfduty);
      }
    });

    //- 责任追究div控制代码 绑事件 开始 -------------------------------------------------------------
    function initIfDutyDiv(ifDuty){
      var val = ifDuty.value ? ifDuty.value : ifDuty;
      var validArr = ["fDutyinvestigationtyp" ,"fConfirmdutyinvest" ,"fIdentification"];
      if (val == "是") {
        $(".zerenzhuijiuTr").show();
        $(".qbdms-SubTableTitle").show();
        $(".qbdms-tableDiv").show();
        common.setComponentRequired(validArr, true);
      } else {
        $(".zerenzhuijiuTr").hide();
        $(".qbdms-SubTableTitle").hide();
        $(".qbdms-tableDiv").hide();
        common.setComponentRequired(validArr, false);
        common.clearComponentVal(validArr);
        // 删除子表数据条目
        $(".subDeleteTr").each(function(){
          if ($(this).parents(".subContTem").length == 0) {
            $(this).trigger("click");
          }
        });
      }
    }

    //下载附件
    window.downFile = function (obj) {
      var fileId = $(obj).parents("span").attr("fileId");
      window.location.href = serverPath.qbdmsPath + setter.extendLinkPath + "attachFile/download?fileId=" + fileId;
    };

    publicMethods.bottomFixd();
    $(".uploadFileCont .qbdms-fileUp,.uploadFileCont i,.addFormTr1").hide();
    var id="${id}";
    var i=0;
    var j=0;
    var contentData;
    $.ajax({
      url: serverPath.qbdmsPath + "/qbdms/wQbdFalProblemreset/getAllProgress?id="+id,
      type: "get",
      dataType: 'json',
      success: function (data) {
        contentData=data.data;
        j= data.data.length;
        if(data.data.length>4){
          j=4;
        }
          for(i;i<j;i++){
            var li = '<li class="layui-timeline-item">'
                +'  <i class="layui-icon layui-timeline-axis"></i>'
                +' <div class="layui-timeline-content layui-text">'
                +' <div class="layui-timeline-title">'
                +data.data[i].createTime
                + '&nbsp;&nbsp;'
                +data.data[i].content
                +'</div>'
                +'</div>'
                +'</li>'
            $("#contentList").append(li);
          }
        }
      })
    $("#more").click(function(){
      if(j<4){
        return false;
      }
      for(j;j<contentData.length;j++){
        var li = '<li class="layui-timeline-item">'
            +'  <i class="layui-icon layui-timeline-axis"></i>'
            +' <div class="layui-timeline-content layui-text">'
            +' <div class="layui-timeline-title">'
            +contentData[j].createTime
            + '&nbsp;&nbsp;'
            +contentData[j].content
            +'</div>'
            +'</div>'
            +'</li>'
        $("#contentList").append(li);
      }
    })

    $("#save").click(function(){
      var content=$("#content").val();
      if(content.trim()==""){
        layer.alert(publicMethods.confirmStyle("反馈内容不能为空！"),{title: false,skin: 'confirm-class'});
        return false;
      }
      if(content.length>500){
        layer.alert(publicMethods.confirmStyle("最多输入500个字！"),{title: false,skin: 'confirm-class'});
        return false;
      }
      $.ajax({
        url: serverPath.qbdmsPath + "/qbdms/wQbdFalProblemreset/saveProgress",
        type: "get",
        data:{"problemId":id,
          "content":content
        },
        dataType: 'json',
        success: function (data) {
          layer.alert(publicMethods.confirmStyle(data.msg),{title: false,skin: 'confirm-class'}, function (index) {
            layer.close(index);
            document.location.reload();
          })
        }
      })
    });
  });
</script>
</body>
</html>